var v = new Vue({
    el:'#app',
    data () {
        return {
            menu:[],
            name:'',
            pass:''
        }
    },
    methods:{

        //加载菜单数据
       loadData(){
           axios({
               url:'menu/getCurrentUserAllMenu.do',
               method:'post'

           }).then(function (res) {
               v.menu = res.data;
           }).catch(function (reason) {
               alert('请求失败')
           });
       },

        updateData(){
            axios({
                url:'user/rePwd.do',
                method:'post',
                data:{
                    name:this.name,
                    pass:this.pass,
                    id:this.id,
                }

            }).then(function (res) {
                if(res.data.result=='success'){
                    alert('修改成功！');
                    v.clearData();
                    //刷新数据
                    v.loadData();
                }else{
                    alert('修改失败！');
                }

            }).catch(function (reason) {

            });
        },

    },
    mounted () {
        this.loadData();
    }

});
window.jQuery || document.write('<script src="../riqi/js/jquery-1.11.0.min.js"><\/script>')